<template>
  <header class="header">
      <h1>todos</h1>
      <input class="new-todo" placeholder="请输入任务名称" autofocus v-model="msg" @keyup.enter="add(msg)"/>
    </header>
</template>
<script>
export default {
  name: 'TheHeader',
  props: {
    list:{
        type:Array,
        required:true,
    }
  },
  data(){
    return{
        msg:''
    }
  },
  methods:{
    add(value){
        this.$emit('add',value)
        this.msg=''
    }
  }
};
</script>
<style lang='less' scoped>
</style>